﻿using System.Linq.Expressions;
using System;


namespace Devtm.ServiceModel.Discovery.Collection
{


    public delegate void ItemPropertyChangedEventHandler<T>(object sender, ItemPropertyChangedEventArgs<T> e);


    public interface ITableCollection<T, TKey> : ITableIndexedCollection<T>
    {

        Expression<Func<T, TKey>> FieldExpression { get; set; }

        //TableCollection<T, TKey> Clone();

        T Add(TKey key, T item);

        bool ContainsKey(TKey key);


        //T Detach(TKey key);

        T Get(TKey key);
        TKey GetKey(T item);

        //event System.Collections.Specialized.NotifyCollectionChangedEventHandler CollectionChanged;
        event ItemPropertyChangedEventHandler<T> PropertyItemChanged;



        void RemoveKey(TKey key);
        T this[TKey key] { get; }
        bool TryGet(TKey key, out T item);

        bool TryRemoveKey(TKey key);
        //bool TryRemove(T item);

    }

}
